package cn.wusifx.zabbix.request.builder.maintenance;

import cn.wusifx.zabbix.request.BaseRequest;
import cn.wusifx.zabbix.request.builder.CreateRequestBuilder;

import java.util.List;
import java.util.Map;

/**
 * https://www.zabbix.com/documentation/4.0/manual/api/reference/maintenance/create
 */
public class MaintenanceCreateRequestBuilder extends CreateRequestBuilder {
    private String name;
    private Long activeSince;
    private Long activeTill;
    private Integer tagsEvaltype;
    private List<String> groupIds;
    private List<String> hostIds;
    private List<Map<String,Object>> timePeriods;
    public MaintenanceCreateRequestBuilder(String auth) {
        super("maintenance.create", auth);
    }

    public MaintenanceCreateRequestBuilder(Long id, String auth) {
        super("maintenance.create", id, auth);
    }

    public String getName() {
        return name;
    }

    public MaintenanceCreateRequestBuilder setName(String name) {
        this.name = name;
        return this;
    }

    public Long getActiveSince() {
        return activeSince;
    }

    public MaintenanceCreateRequestBuilder setActiveSince(Long activeSince) {
        this.activeSince = activeSince;
        return this;
    }

    public Long getActiveTill() {
        return activeTill;
    }

    public MaintenanceCreateRequestBuilder setActiveTill(Long activeTill) {
        this.activeTill = activeTill;
        return this;
    }

    public Integer getTagsEvaltype() {
        return tagsEvaltype;
    }

    public MaintenanceCreateRequestBuilder setTagsEvaltype(Integer tagsEvaltype) {
        this.tagsEvaltype = tagsEvaltype;
        return this;
    }

    public List<String> getGroupIds() {
        return groupIds;
    }

    public MaintenanceCreateRequestBuilder setGroupIds(List<String> groupIds) {
        this.groupIds = groupIds;
        return this;
    }

    public List<String> getHostIds() {
        return hostIds;
    }

    public MaintenanceCreateRequestBuilder setHostIds(List<String> hostIds) {
        this.hostIds = hostIds;
        return this;
    }

    public List<Map<String, Object>> getTimePeriods() {
        return timePeriods;
    }

    public MaintenanceCreateRequestBuilder setTimePeriods(List<Map<String, Object>> timePeriods) {
        this.timePeriods = timePeriods;
        return this;
    }

    @Override
    public BaseRequest<Map<String, Object>> builder() {
        baseRequest.getParams().put("name",name);
        baseRequest.getParams().put("active_since",activeSince);
        baseRequest.getParams().put("active_till",activeTill);
        baseRequest.getParams().put("tags_evaltype",tagsEvaltype);
        baseRequest.getParams().put("groupids",groupIds);
        baseRequest.getParams().put("hostids",hostIds);
        baseRequest.getParams().put("timeperiods",timePeriods);
        return baseRequest;
    }
}
